﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<EditorModel>" %>

<%@ Import Namespace="NewsPortal.Models" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Новостной портал</title>
    <link rel="stylesheet" href="/css/main.css" type="text/css"/>
</head>
<body>
    <div>
            <form action="/Editor/Add" method="post" enctype="multipart/form-data">
            Title:<br />
            <textarea name="title" value="" src="400" ></TEXTAREA>
            <br />
            ShortText:<br />
            <textarea name="shortText" value="" style="height: 94px; width: 400px"></TEXTAREA>
            <br />
            Body:<br />
            <textarea name="body" value="" style="height: 123px; width: 400px" ></textarea><br />
            Category:<br />
            <% 
                IEnumerable<SelectListItem> asdf = Model.Categories.Select<NewsPortal.DataContracts.Category, SelectListItem>
                    (
                        x => new SelectListItem{ 
                            Text = x.Title,Value = x.Id.ToString()
                        }
                    ); %>
            <%=Html.ListBox("category",asdf)%><br />
            Picture:<br />
            <input type="file" name="file"/>
            <input type="submit" name="name" value="Post" />
            </form>    
            <% if(ViewData["error"] != null)
               {
                %>
                <div class = "error">
                    <%=ViewData["error"]%>
                </div>
                    <%                    
                }
                %>
                <% if(ViewData["ok"] != null)
               {
                %>
                <div class = "ok">
                    <%=ViewData["ok"]%>
                </div>
                    <%                    
                }
                %>
    </div>
</body>
</html>
